﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Roboter
{
    /// <summary>
    /// Interaktionslogik für MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        Controller controller;
        public MainWindow()
        {
            InitializeComponent();

        }

        private void OpenFileDialog(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();



            // Set filter for file extension and default file extension

            openFileDialog.DefaultExt = ".txt";

            openFileDialog.Filter = "Text documents (.txt)|*.txt";



            // Display OpenFileDialog by calling ShowDialog method

            Nullable<bool> result = openFileDialog.ShowDialog();



            // Get the selected file name and display in a TextBox

            if (result == true)
            {
                ReadFile readIn = new ReadFile(openFileDialog.FileName);
                controller = new Controller(readIn);
                controller.Draw(this.drawArea);
                
            }
        }
    }
}
